var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/mern-starter');

var group_Schema = mongoose.Schema({
  exam_id: String, //id2
  name: String,
  members: String,
  is_marked: String,
});

var group = mongoose.model('exam_groups', group_Schema);

var exam_Schema = mongoose.Schema({
  name: String,
  start_time: String,
  stop_time: String,
  address: String,
  teachers: String,
  classes: String,
  status: String, //0：未开始 1: 签到  2：打分 3：结束
  student: String,
  score_way: String, // "score" or "level"
  levels_num: String,
  detail: String
});

var exam = mongoose.model('exam_exams', exam_Schema);

var grade_Schema = mongoose.Schema({
  exam_id: String,
  grades: Array,
  studentId: String,
  name:String
});

var grade = mongoose.model('exam_grades', grade_Schema);

module.exports = {
  group: group,
  exam: exam,
  grade: grade
};
